JH Thought Lab

Hello Go!

I’ve been learning Go. I’ve been very intrigued by the promise of language whose designers decide to do things differently in the name of practicality and which has be proven at scale by Google. I've read a couple articles that discuss the rationale for Go and compare it to C#/Java, which is the language 'style' that I'm most familiar with. The simplicity and pragmatism that Go brings to improve on these languages really make sense.

Things that I like ❤️:

  • Go fmt: I love the universal, enforced formatting. I love that it cares about the details, like the format of package and function documentation comments.

  • Go test: Universal and with built-in benchmarking, what's not to love.

  • Composition over inheritance: Not having a type hierarchy and using type embeddings instead strikes me as a great idea.

  • Default pass by value: I'll always take something that helps me err to pure functions.

  • Clever and clear syntax: For instance, I the concept of labels for breaking out of for loops.

Things that I'm still on the fence about🤺:

  • No generics: It seems to me as though no list comprehensions or standard higher order functions and no generic algorithms is a pretty big price to pay. That said, the Summary of Go Generics Discussions seems to make a pretty good case for why they are left out.

  • No overloads: When using the .NET StringBuilder for example, it is pretty nice to just be able to append whatever type you have. In comparison, you have to convert number types to string to use the Go string Builder.

  • Panic & Recover: I'm still getting familiar with the idea of panic & recover. It seems like intention is to avoid the misuse of try & catch in other languages, but I'm still getting used to it.

I've been using HackerRank and Exercism to help learn. I've found Exercism in particular to be a fantastic service 🙏. Looking forward to the next steps in the Go journey ⛰!️